/* File 3 of 3 for Table 5 */

cap log close
log using industry_year_regressions, replace

use GWgapr10_indyreg_pca_allobs_data, clear 

su se_discrim_f_TL, de

egen ind3 = group(pf_ind)
gen ind1g = substr(pf_ind,1,2)
gen ind2g = substr(pf_ind,1,3)
egen ind2 = group(ind2g)
egen ind1 = group(ind1g)

drop ind1g ind2g

gen lnvapw_sd = ln(val_ad_pw_sd)
gen highskill_diff = (srec_manag_hc_lg5 + srec_tech_hc_lg5)/2

qui foreach i of varlist lnvapw_sd empfrac_hc_manag_lg5 highskill_diff {
su `i'
replace `i' = (`i'-r(mean))/r(sd)
}

reg c_discrim_f_TL empfrac_hc_manag_lg5 lnvapw_sd highskill_diff i.year [pw=1/ se_discrim_f_TL], cluster(ind3)
outreg2 using C:\data\ind_year.xls, 10pct replace excel

reg c_discrim_f_TL empfrac_hc_manag_lg5 lnvapw_sd highskill_diff i.year i.ind1 [pw=1/ se_discrim_f_TL], cluster(ind3)
outreg2 using C:\data\ind_year.xls, 10pct append excel

reg c_discrim_f_TL empfrac_hc_manag_lg5 lnvapw_sd highskill_diff i.year i.ind2 [pw=1/ se_discrim_f_TL], cluster(ind3)
outreg2 using C:\data\ind_year.xls, 10pct append excel

reg c_discrim_f_TL empfrac_hc_manag_lg5 lnvapw_sd highskill_diff i.year i.ind3 [pw=1/ se_discrim_f_TL], cluster(ind3)
outreg2 using C:\data\ind_year.xls, 10pct append excel

reg c_discrim_f_TL empfrac_hc_manag_lg5 c.lnvapw_sd##c.highskill_diff i.year [pw=1/ se_discrim_f_TL], cluster(ind3)
outreg2 using C:\data\ind_year.xls, 10pct append excel

reg c_discrim_f_TL empfrac_hc_manag_lg5 c.lnvapw_sd##c.highskill_diff i.year i.ind1 [pw=1/ se_discrim_f_TL], cluster(ind3)
outreg2 using C:\data\ind_year.xls, 10pct append excel

reg c_discrim_f_TL empfrac_hc_manag_lg5 c.lnvapw_sd##c.highskill_diff i.year i.ind2 [pw=1/ se_discrim_f_TL], cluster(ind3)
outreg2 using C:\data\ind_year.xls, 10pct append excel

reg c_discrim_f_TL empfrac_hc_manag_lg5 c.lnvapw_sd##c.highskill_diff i.year i.ind3 [pw=1/ se_discrim_f_TL], cluster(ind3)
outreg2 using C:\data\ind_year.xls, 10pct append excel

log close


